package com.ruben.state.example;

import java.util.Collections;
import java.util.Map;
import java.util.Objects;

/**
 * 待审核
 *
 * @author <achao1441470436@gmail.com>
 * @since 2021/10/17 18:48
 */
public class WaitStatus extends BaseStatus {

    /**
     * 审核
     *
     * @param param 参数
     * @return 结果
     */
    @Override
    public Map<String, Object> execute(Map<String, Object> param) {
        boolean pass = Objects.nonNull(param.get(CONTENT));
        ApprovalStatus status;
        if (pass) {
            status = new PassStatus();
        } else {
            System.out.println("提交内容为空，审核未通过");
            status = new RejectStatus();
        }
        executor.changeStatus(status);
        return Collections.singletonMap(STATUS, status.getClass().getSimpleName());
    }
}
